package com.kantboot.tool.edu.web.admin.controller;

import com.kantboot.global.data.change.annotaion.DataChange;
import com.kantboot.global.data.change.common.CommonDataChangeKey;
import com.kantboot.tool.edu.domain.entity.ToolEduMajor;
import com.kantboot.tool.edu.service.IToolEduMajorService;
import com.kantboot.util.common.result.RestResult;
import com.kantboot.util.core.controller.BaseAdminController;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 专业
 * 用于管理专业的查询
 */
@RestController
@RequestMapping("/tool-edu/admin/major")
public class ToolEduMajorControllerOfAdmin extends BaseAdminController<ToolEduMajor,Long> {

    @Resource
    private IToolEduMajorService service;

    @Override
    @RequestMapping("/save")
    @DataChange(key= CommonDataChangeKey.CLIENT_INIT)
    public RestResult<Object> save(@RequestBody ToolEduMajor entity) {
        return RestResult.success(service.save(entity), "saveSuccess","保存成功");
    }

    @Override
    @RequestMapping("/remove")
    @DataChange(key=CommonDataChangeKey.CLIENT_INIT)
    public RestResult remove(@RequestBody ToolEduMajor entity) {
        service.remove(entity);
        return RestResult.success(null, "removeSuccess","删除成功");
    }

}
